/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$(document).ready(function(){
  result_bind(function(data){
    restoreForm('visit-add'); 
    $('#clientName').val(data.name);
    $('#clientId').val(data.id);
  });
    
  
  $('#visit-add').submit(function() {
    $.post("ajax/create.jsp", $(this).serialize(), function(data){
      console.log(data);
      resetForm('#visit-add');
    });
    return false;
  });
  
  $('#visit-client-search').click(function(){
    saveForm("visit-add");
    redirectForResult("search_client");
  }); 
  
  $('#visit-client-add').click(function(){
    saveForm("visit-add");
    redirectForResult("create_client");
  }); 
});

